﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using PMS.BusinessFacade;
using PMS.EntityManage;
using PMS.Common;
using PMS.EntityQuery;
using System.Data.SqlClient;
using System.Collections.Generic;
using BusinessFacade;
using EntityManage;
public partial class Modules_Personal_PerfEvaluateOrgPersonalAllSeasonReport : System.Web.UI.Page
{
    IReportHandler rptHandler = new ReportManage();
    ISys_UserHandler userHandler = new Sys_UserManage();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["retu"] = Request.UrlReferrer.ToString();   
            //获取转过来的人员名称绑定数据
            if (Request["UserId"] != null && Request["UserId"] != string.Empty)
            {
                int UserID = 0;
                int.TryParse(Request["UserId"], out UserID);
                SqlParameter[] parms = null;
                List<SqlParameter> lstParm = new List<SqlParameter>();
                lstParm.Add(new SqlParameter("@UserId", UserID.ToString()));
                parms = lstParm.ToArray();
                string clause = " target_user_id=@UserId ";
                dataBind(clause, parms);
            }
        }
    }
    /// <summary>
    /// 绑定四个季度绩效成绩
    /// </summary>
    private void dataBind(string whereClause, SqlParameter[] parms)
    {
        try
        {
            DataTable dt = new DataTable();
            if (whereClause != string.Empty)
            {
                dt = rptHandler.GetPerfEvaluateOrgAllSeasonDataByPageList(whereClause, parms, 0, 1);
                whereClause = "1=1";
            }
            this.gvPersonalList.DataSource = dt;
            this.gvPersonalList.DataBind();
        }
        catch
        {
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {

    }
    protected void ApprovalButton_Click(object sender, EventArgs e)
    {

    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("PerfEvaluateOrgPersonalReport.aspx"); 
    }
    
    protected void gvPersonalList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "GetByScore")
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), string.Format("window.location.href='PerfEvaluateOrgPersonalSeasonDetail.aspx?season={0}&UserId=" + Request["UserId"] + "'", e.CommandArgument.ToString()), true);
            //Response.Redirect("PerfEvaluateOrgPersonalSeasonDetail.aspx?season=" + e.CommandArgument.ToString() + "&UserId=" + Request["UserId"]);
        }
    }
    protected void gvPersonalList_Sorting(object sender, GridViewSortEventArgs e)
    {

    }
    protected void gvPersonalList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

        }
    }
}
